﻿using Newtonsoft.Json;

namespace OneWorks.Web.Common.ActionResults
{
    public class CustomJsonResult<T> : CustomResult<T>
    {
        private T _data;

        public T Data
        {
            get { return _data; }
            set { _data = value; }
        }

        public Formatting Format { get; set; }

        public JsonSerializerSettings Settings { get; set; }

        public CustomJsonResult()
        {
        }

        public CustomJsonResult(T data)
        {
            _data = data;
        }

        public CustomJsonResult(T data, Formatting format)
        {
            _data = data;
            Format = format;
        }

        public CustomJsonResult(T data, Formatting format, JsonSerializerSettings settings)
        {
            _data = data;
            Format = format;
            Settings = settings;
        }

        public override T GetObject()
        {
            return _data;
        }
    }
}
